#include <Lucnx/stdlib.h>
#include <Lucnx/debug.h>
#include <Lucnx/luxfs.h>

#define FREE_BLOCK_START 300

void fs_init(u32 magic)
{
    super_t sb;
    sb.magic = magic;

    sb.inode_table_lba = FREE_BLOCK_START;
    sb.inode_table_sectors = DIV_ROUND_UP(sizeof(inode_t) * MAX_FILES, BLOCK_SIZE);
    DEBUGK("inode table lba:%x\n", sb.inode_table_lba);

    sb.inode_map_lba = sb.inode_table_lba + sb.inode_table_sectors;
    sb.inode_map_sectors = DIV_ROUND_UP(4096 / 8, BLOCK_SIZE);
    DEBUGK("inode map lba:%x\n", sb.inode_map_lba);

    sb.block_map_lba = sb.inode_map_lba + sb.inode_map_sectors;

}